@inherits BaseComponent

@namespace FluentCMS.Web.UI.Components

@if(Visible)
{
    <nav @attributes="AdditionalAttributes"
         class="@this.GetClasses()">
        <ul>
            <PaginationItem Disabled="!this.CanPrevious()"
                            @onclick="Previous">
                @if (ShowIcons)
                {
                    <Icon Name="IconName.Previous" />
                }
                else
                {
                    <text>Previous</text>
                }
            </PaginationItem>
            @foreach (var Page in this.Pages())
            {
                <PaginationItem @key="Page"
                                Active="Page == Current"
                                @onclick="() => GoTo(Page)">
                    @(Page == 0 ? "..." : Page)
                </PaginationItem>
            }
            <PaginationItem Disabled="!this.CanNext()"
                            @onclick="Next">
                @if (ShowIcons)
                {
                    <Icon Name=IconName.Next />
                }
                else
                {
                    <text>Next</text>
                }
            </PaginationItem>
        </ul>
    </nav>
}
